﻿namespace XjjXmm.CodeGenerator
{
    public class NetEntityGeneratorStrangy : NetBaseGeneratorStrangy
    {

    }

    public class NetIRepositoryGeneratorStrangy : NetBaseGeneratorStrangy
    {
        public override dynamic GetTableModel(TableInfo table)
        {
            // table.PropertyName = GetTableName(table);

            return new
            {
                DbName = table.DbName,
                PropertyName = GetTableName(table),
                Description = table.Description,
                EntityName = GetEntityName(table)
            };
        }

        protected override string GetTableName(TableInfo table)
        {
            var res = base.ConverCamlName(table.DbName);
           
            return "I" + res + "Repository";
        }

        protected virtual string GetEntityName(TableInfo table)
        {
            var res = base.ConverCamlName(table.DbName);

            return  res + "Entity";
        }

    }

    public class NetRepositoryGeneratorStrangy : NetIRepositoryGeneratorStrangy
    {
        protected override string GetTableName(TableInfo table)
        {
            var res = base.ConverCamlName(table.DbName);

            return res + "Repository";
        }
    }
}
